﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Acme.BookStore.Car
{
    public class VehicleAppService :CrudAppService<Vehicle,VehicleDto,Guid,PagedAndSortedResultRequestDto,CreateUpdateVehicleDto>,IVehicleAppService
    {
        public VehicleAppService(IRepository<Vehicle, Guid> repository)
            : base(repository)
        {
        }
        public async Task<List<VehicleLookupDto>> GetVehicleNumberLookupAsync()
        {
            var vehicles = await Repository.GetListAsync();
            return vehicles.Select(x => new VehicleLookupDto
            {
                Id = x.Id,
                VehicleNumber = x.VehicleNumber
            }).ToList();
        }
    }
}
